from .basedata import *

class QToolsPanelGUI(wx.Panel, BaseData):

    def __init__(self, parent = None):
        BaseData.__init__(self)
        wx.Panel.__init__(self, parent, wx.ID_ANY)
        
        self._init_UI()  # 初始化界面布局

    def _init_UI(self):
        """初始化UI"""
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.SetBackgroundColour(CON_COLOR_MAIN)

        self.panel = wx.Panel(self, wx.ID_ANY)
        topsizer = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(topsizer)
        topsizer.SetSizeHints(self.panel)
        sizer.Add(self.panel, 1, wx.EXPAND)

        '''
            用滚动面板存储所有控件，适配更小屏幕使用
        '''
        self.scollPanel = scrolledpanel.ScrolledPanel(self.panel, -1)
        self.scollPanel.SetupScrolling()
        self.scollPanelSizer = wx.BoxSizer(wx.VERTICAL)
        self.scollPanel.SetSizer(self.scollPanelSizer)
        topsizer.Add(self.scollPanel, 1, wx.EXPAND | wx.ALL, 0)
        self.scollPanel.SetBackgroundColour(CON_COLOR_GREY)

        self._init_scroll_UI()

    def _init_scroll_UI(self):
        '''初始化滚动面板布局'''
        '''
            一些快捷按钮
        '''
        self.staticBoxUI2PYShortcut = wx.StaticBox(self.scollPanel, -1, '快捷按钮')
        self.staticBoxUI2PYShortcutSizer = wx.StaticBoxSizer(self.staticBoxUI2PYShortcut, wx.HORIZONTAL)
        self.scollPanelSizer.Add(self.staticBoxUI2PYShortcutSizer, 0, wx.EXPAND | wx.ALL, 6)

        self.btnUIDesigner = buttons.GenButton(self.scollPanel, -1, '打开ui设计器')
        self.btnUIDesigner.SetBackgroundColour(CON_COLOR_MAIN)
        self.btnUIDesigner.SetForegroundColour(CON_COLOR_PURE_WHITE)
        self.staticBoxUI2PYShortcutSizer.Add(self.btnUIDesigner, 0, wx.EXPAND | wx.ALL, 6)

        '''
            .ui 到 .py 的转换
        '''
        self.staticBoxUI2PY = wx.StaticBox(self.scollPanel, -1, '.ui --> .py')
        self.staticBoxUI2PYSizer = wx.StaticBoxSizer(self.staticBoxUI2PY, wx.VERTICAL)
        self.scollPanelSizer.Add(self.staticBoxUI2PYSizer, 0, wx.EXPAND | wx.ALL, 6)
        
        self.btnChoiceUIandPath = buttons.GenButton(self.scollPanel, -1, label=BTN_CHOICE_UI_PY, size=(-1, 44))
        self.staticBoxUI2PYSizer.Add(self.btnChoiceUIandPath, 0, wx.EXPAND | wx.ALL, 2)
        self.btnChoiceUIandPath.SetBackgroundColour(CON_COLOR_MAIN)
        self.btnChoiceUIandPath.SetForegroundColour(CON_COLOR_PURE_WHITE)
